package com.fyzk.activity.prize.detail;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tyjc.lottery.R;
import http.DataUtil.text.TextUtil;

public class PrizeDetailSalesBonusView extends RelativeLayout{
	private Context mContext;
	private TextView mTxt_sales;
	private TextView mTxt_bonus;

	private LinearLayout mLl_bonus;
	private View mLl_view;

	public PrizeDetailSalesBonusView(Context context) {
		this(context, null);
	}

	public PrizeDetailSalesBonusView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public PrizeDetailSalesBonusView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		mContext = context;
		View.inflate(mContext, R.layout.zy_layout_peizedetail_middle_salesandbonus, this);
		initView();
	}

	
	private void initView(){
		mTxt_sales = (TextView) findViewById(R.id.zy_txt_prizedetail_sales);
		mTxt_bonus = (TextView) findViewById(R.id.zy_txt_prizedetail_bonus);
		mLl_bonus = (LinearLayout) findViewById(R.id.zy_ll_prizedetail_bonus);
		mLl_view = (View) findViewById(R.id.zy_ll_view);
	}
	
	public void setBonus(String bonus){
		if(TextUtil.isEmpty(bonus)){
			mTxt_bonus.setText("中心未发布");
		}else{
			if(Long.valueOf(bonus) <= 0){
				mLl_view.setVisibility(View.GONE);
				mLl_bonus.setVisibility(View.GONE);
			}else{
				mTxt_bonus.setText(bonus);
			}
		}
	}
	
	public void setSales(String sales){
		if(TextUtil.isEmpty(sales)){
			mTxt_sales.setText("中心未发布");
		}else{
			mTxt_sales.setText(sales);
		}
	}
	

}
